package com.yy.bugzillahelp.log;

import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;

public class LoggerUtil {

    public static void config() {
        try {
            checkLogPath();
            LogManager.getLogManager().readConfiguration(LoggerUtil.class.getResourceAsStream("logging.properties"));
        } catch (IOException ex) {
            Logger.getLogger(LoggerUtil.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SecurityException ex) {
            Logger.getLogger(LoggerUtil.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private static void checkLogPath() {
        File f = new File(System.getProperty("user.home") + "/bugzilla-help/");
        if (!f.exists()) {
            System.out.println(false);
            f.mkdirs();
        }
    }
}
